﻿namespace VkApi
{
    public class VkProfile : VkProfileBase
    {
        public long Uid { get; set; }
        public string FirstName { get; set; }
        public string LastName { get; set; }
        public override string Name { get { return FirstName + " " + LastName; } set {}} //for binding
        public VkSex Sex { get; set; }
        public override string PhotoUrl { get; set; }
        public string PhotoMediumUrl { get; set; }
        public bool IsOnline { get; set; }
        public string ScreenName { get; set; } //nickname or id*****

        public static VkSex ParseSex(string input)
        {
            int sex;
            if (int.TryParse(input, out sex))
            {
                return sex == 1 ? VkSex.Female : VkSex.Male;
            }
            return VkSex.Male;
        }

        public static bool ParseOnline(string input)
        {
            int online;
            if (int.TryParse(input, out online))
            {
                return online != 0;
            }
            return false;
        }
    }
}
